<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0,maximum-scale=1.0" />
    <script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.4/??flexible_css.js,flexible.js"></script>
    <link rel="stylesheet" type="text/css" href="css/reset.css"/>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/public.js" type="text/javascript" charset="utf-8"></script>
    <title>海底捞</title>
		
</head>
<body>
	<div id="home">
		<!--<div class="conTitle">海底捞</div>-->
		<div class="conLogo">
			<img class="logo" src="images/logo@1x.png"/>
			<span class="logoName">海底捞（江苏路店）</span>
		</div>
		<div class="conBar">
			<a href="javascript:void(0);" class="list">
				<img class="listIcon" src="images/icon_canju@1x.png"/>
				<span class="listName">预定点餐</span>
			</a>
			<a href="startMeal.html" class="list">
				<img class="listIcon" src="images/icon_diancan@1x.png"/>
				<span class="listName">开始点餐</span>
			</a>
			<a href="javascript:void(0);" class="list">
				<img class="listIcon" src="images/icon_fuwuyuan@1x.png"/>
				<span class="listName">叫服务员</span>
			</a>
			<a href="javascript:void(0);" class="list">
				<img class="listIcon" src="images/icon_yhq@1x.png"/>
				<span class="listName">领优惠券</span>
			</a>
		</div>
		<div class="conList">
			<div class="explain">
				成为会员享受更多优惠权益
				<a href="javascript:void(0);" class="go_kt">去开通</a>
			</div>
			<div class="ft_txt">
				<p>邦伲德（上海）网络技术有限公司 技术支持</p>
				<p>Copyright © 2018 bonnidee. All Rights Reserved.</p>
			</div>
		</div>
		<p></p>
        <input type="hidden" name="table" id="table"  />
        <input type="hidden" name="store_id" id="store_id"  />
	</div>

	<script type="text/javascript">
        //适配
        //(function() {
        //      var newRem = function() {
        //          var html = document.documentElement;
        //          html.style.fontSize = html.getBoundingClientRect().width / 16 + 'px';
        //      };
        //      window.addEventListener('resize', newRem, false);
        //      newRem();
        //  })();

        $(function () {
            //获取地址栏参数
            (function ($) {
                $.getUrlParam = function (name) {
                    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                    var r = window.location.search.substr(1).match(reg);
                    if (r != null) return unescape(r[2]);
                    return '';
                }
            })
            (jQuery);

            $("#table").val($.getUrlParam('table'));//桌号
            $("#store_id").val($.getUrlParam('store_id'));//店铺id

            //清空购物车
            $.ajax({
                url:url() + "index.php/Api/Car/del",
                dataType:"json",
                type:"get",
                success:function (data){
                    // console.log(data)
                }
            })

            var store_id=$.getUrlParam('store_id');
            var table=$.getUrlParam('table');
            //获取用户信息
            getUserInfo(store_id);
            //获取店铺基本信息
			getStoreInfo(store_id)
        })

       //获取用户信息
        function getUserInfo(store_id) {
            var store_id=store_id;
            $.ajax({
                url: url() + 'index.php/Api/Index/getUserInfo',    //请求的url地址
                dataType: "json",   //返回格式为json
                async: true,//请求是否异步，默认为异步，这也是ajax重要特性
                type: "GET",   //请求方式
                data: {
                    store_id:store_id,
                },
                success: function (data) {
                    if(data.state == 1){
                        window.location.href = url() + "index.php?m=Api&c=WeChat&a=start&store_id="+store_id;//微信授权登录
                    }else{
                        console.log(data)
                        var storage=window.localStorage;
                        storage.setItem("customer_id",data.data.customer_id)
                    }
                }
            });
        }

        //获取店铺信息
		function getStoreInfo(store_id){
            var store_id=store_id
            $.ajax({
                url: url() + 'index.php/Api/Index/getStoreInfo',    //请求的url地址
                dataType: "json",   //返回格式为json
                async: true,//请求是否异步，默认为异步，这也是ajax重要特性
                type: "GET",   //请求方式
                data: {},
                success: function (data) {
                    if(data.state ==1){
                       console.log(data);
                        var html = ''
                        $.each(data.data, function (i, item) {

						});


                    }else if(data.state==-1){
                        alert('参数错误请检查')
                    }else if(data.state==0){
                        alert('获取店铺信息失败请检查')
                    }
                }
            });
		}
	</script>

</body>
</html>